<template>
  <div class="goods-detail" v-for="goods in goodsList" :key="goods.productId">
    <div class="top">
      <img :src="goods.mainPicUrl || defaultImage" alt="" />
      <div style="flex: 1">
        <div class="goods-name">{{ goods.productName }}</div>
        <div class="goods-info">
          <div>上架类目：{{ goods.preview }}</div>
          <div>型号：{{ goods.modeCode }}</div>
          <div>分类：{{ goods.categoryName }}</div>
          <div class="jzt-flex-bt" v-if="goods?.list?.length > 0">
            <span> ID：{{ goods.productId }}</span>
            <span>当前商品已有（{{ goods.businessNum }}）家采购商签约合同，占用数量（{{ goods.total }}）套</span>
          </div>
        </div>
      </div>
    </div>
    <div class="goods-occupy-list" v-if="goods?.list?.length > 0">
      <OccupyTable :tableData="goods?.list" :setStyle="{ width: '100%' }" />
    </div>
  </div>
</template>

<script setup>
import OccupyTable from "./occupyTable.vue";
defineProps(["goodsList", "defaultImage"]);
</script>

<style lang="scss" scoped>
.goods-detail {
  & > .top {
    display: flex;
    gap: 20px;
    line-height: 2;
    padding: 20px;
    border: 1px solid #dcdfe6;
    box-sizing: border-box;
    background-color: #f5f7fa;
  }

  img {
    width: 150px;
    height: 150px;
    border-radius: 4px;
  }

  > div {
    width: 100%;
  }

  .goods-name {
    font-size: 18px;
    color: #007dff;
  }

  .goods-info {
    text-align: left;
    position: relative;
    width: 100%;

    .area {
      color: #007dff;
      cursor: pointer;
      position: absolute;
      bottom: 0;
      right: 0;

      .el-tag {
        margin-left: 8px;
      }
    }
  }
}
</style>
